home *** CD-ROM | disk | FTP | other *** search
/ Freelog 22 / freelog 22.iso / Prog / Djgpp / DJDEV203.ZIP / include / stdlib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-06-03  |  4.8 KB  |  154 lines

  1. /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
  2. /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
  3. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  4. #ifndef __dj_include_stdlib_h_
  5. #define __dj_include_stdlib_h_
  6.  
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10.  
  11. #ifndef __dj_ENFORCE_ANSI_FREESTANDING
  12.  
  13. #include <sys/djtypes.h>
  14.   
  15. /* Some programs think they know better... */
  16. #undef NULL
  17.  
  18. #define EXIT_FAILURE    1
  19. #define EXIT_SUCCESS    0
  20. #define MB_CUR_MAX    __dj_mb_cur_max
  21. #define NULL        0
  22. #define RAND_MAX    2147483647
  23.  
  24. extern int __dj_mb_cur_max;
  25.  
  26. typedef struct {
  27.   int quot;
  28.   int rem;
  29. } div_t;
  30.  
  31. typedef struct {
  32.   long quot;
  33.   long rem;
  34. } ldiv_t;
  35.  
  36. __DJ_size_t
  37. #undef __DJ_size_t
  38. #define __DJ_size_t
  39. __DJ_wchar_t
  40. #undef __DJ_wchar_t
  41. #define __DJ_wchar_t
  42.  
  43. void    abort(void) __attribute__((noreturn));
  44. int    abs(int _i);
  45. int    atexit(void (*_func)(void));
  46. double    atof(const char *_s);
  47. int    atoi(const char *_s);
  48. long    atol(const char *_s);
  49. void *    bsearch(const void *_key, const void *_base, size_t _nelem,
  50.         size_t _size, int (*_cmp)(const void *_ck, const void *_ce));
  51. void *    calloc(size_t _nelem, size_t _size);
  52. div_t    div(int _numer, int _denom);
  53. void    exit(int _status) __attribute__((noreturn));
  54. void    free(void *_ptr);
  55. char *    getenv(const char *_name);
  56. long    labs(long _i);
  57. ldiv_t    ldiv(long _numer, long _denom);
  58. void *    malloc(size_t _size);
  59. int    mblen(const char *_s, size_t _n);
  60. size_t    mbstowcs(wchar_t *_wcs, const char *_s, size_t _n);
  61. int    mbtowc(wchar_t *_pwc, const char *_s, size_t _n);
  62. void    qsort(void *_base, size_t _nelem, size_t _size,
  63.           int (*_cmp)(const void *_e1, const void *_e2));
  64. int    rand(void);
  65. void *    realloc(void *_ptr, size_t _size);
  66. void    srand(unsigned _seed);
  67. double    strtod(const char *_s, char **_endptr);
  68. long    strtol(const char *_s, char **_endptr, int _base);
  69. unsigned long    strtoul(const char *_s, char **_endptr, int _base);
  70. int    system(const char *_s);
  71. size_t    wcstombs(char *_s, const wchar_t *_wcs, size_t _n);
  72. int    wctomb(char *_s, wchar_t _wchar);
  73.  
  74. #ifndef __STRICT_ANSI__
  75.  
  76. #ifndef _POSIX_SOURCE
  77.  
  78. typedef struct {
  79.   long long quot;
  80.   long long rem;
  81. } lldiv_t;
  82.  
  83. void *        alloca(size_t _size);
  84. long double    _atold(const char *_s);
  85. long long    atoll(const char *_s);
  86. void        cfree(void *_ptr);
  87. double          drand48(void);
  88. char *        ecvtbuf(double _val, int _nd, int *_dp, int *_sn, char *_bf);
  89. char *        ecvt(double _val, int _nd, int *_dp, int *_sn);
  90. double          erand48(unsigned short state[3]);
  91. char *        fcvtbuf(double _val, int _nd, int *_dp, int *_sn, char *_bf);
  92. char *        fcvt(double _val, int _nd, int *_dp, int *_sn);
  93. char *        gcvt(double _val, int _nd, char *_buf);
  94. char *        getpass(const char *_prompt);
  95. int        getlongpass(const char *_prompt, char *_buffer, int _max_len);
  96. char *        itoa(int value, char *buffer, int radix);
  97. long            jrand48(unsigned short state[3]);
  98. long long    llabs(long long _i);
  99. lldiv_t        lldiv(long long _numer, long long _denom);
  100. void            lcong48(unsigned short param[7]);
  101. unsigned long   lrand48(void);
  102. long            mrand48(void);
  103. unsigned long   nrand48(unsigned short state[3]);
  104. int        putenv(const char *_val);
  105. unsigned short *seed48(unsigned short state_seed[3]);
  106. int        setenv(const char *_var, const char *_val, int _replace);
  107. void            srand48(long seedval);
  108. int        stackavail(void);
  109. long double    _strtold(const char *_s, char **_endptr);
  110. long long    strtoll(const char *_s, char **_endptr, int _base);
  111. unsigned long long strtoull(const char *_s, char **_endptr, int _base);
  112. void        swab(const void *from, void *to, int nbytes);
  113.  
  114. #ifndef alloca
  115. #define alloca __builtin_alloca
  116. #endif
  117.  
  118. /* BSD Random Number Generator */
  119. char  *    initstate (unsigned _seed, char *_arg_state, int _n);
  120. char  *    setstate(char *_arg_state);
  121. long    random(void);
  122. int    srandom(int _seed);
  123.  
  124. /* These vary in expected prototype, so we just don't prototype them.
  125. void        xfree(void *_ptr);
  126. void *        xmalloc(size_t _size);
  127. void *        xrealloc(void *ptr, size_t _size);
  128. */
  129.  
  130. #define __system_redirect          0x0001 /* redirect internally */
  131. #define __system_call_cmdproc          0x0002 /* always call COMMAND/$SHELL */
  132. #define __system_use_shell          0x0004 /* use $SHELL if set */
  133. #define __system_allow_multiple_cmds  0x0008 /* allow `cmd1; cmd2; ...' */
  134. #define __system_allow_long_cmds      0x0010 /* handle commands > 126 chars  */
  135. #define __system_emulate_command      0x0020 /* try to emulate the shell */
  136. #define __system_handle_null_commands 0x1000 /* ignore cmds with no effect */
  137. #define __system_ignore_chdir          0x2000 /* make `cd' be a null command */
  138. #define __system_emulate_chdir          0x4000 /* handle `cd' internally */
  139.  
  140. extern int __system_flags;
  141.  
  142. #endif /* !_POSIX_SOURCE */
  143. #endif /* !__STRICT_ANSI__ */
  144. #endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
  145.  
  146. #ifndef __dj_ENFORCE_FUNCTION_CALLS
  147. #endif /* !__dj_ENFORCE_FUNCTION_CALLS */
  148.  
  149. #ifdef __cplusplus
  150. }
  151. #endif
  152.  
  153. #endif /* !__dj_include_stdlib_h_ */
  154.